// import AxColumnAction from '@/components/AxList/AxColumnAction';
import { axconst } from '@/shared/axconst';
import { Table } from 'antd';
import React, { useEffect, useState } from 'react';
// import Detail from './components/detail';

export const Notice: React.FC<any> = props => {
    const { title, scroll = {}, onClick, handleExtraData, ...rest } = props;
    const [data, setData] = useState<any>(axconst.initialList);
    const [loading, setLoading] = useState(false);
    const [detailVisible, setDetailVisible] = useState(false);
    const [id, setId] = useState();

    useEffect(() => {
        setData({
            list: [{
                id: 0,
                title: '通知01',
                releaseTime: '2020-01-02 17:23:22',
            }, {
                id: 1,
                title: '通知02',
                releaseTime: '2020-01-02 17:23:22',
            }],
            success: true,
        });
    }, []);

    const columns = [{
        title: '内容',
        dataIndex: 'title',
        // width: axconst.width.long,
    }, {
        title: '时间',
        dataIndex: 'releaseTime',
        width: axconst.width.time,
        // }, {
        //     title: '操作',
        //     width: axconst.width.two,
        //     render: (val: any, record: any) => (
        //         <AxColumnAction
        //             buttons={[
        //                 {
        //                     text: '详情',
        //                     group: false,
        //                     onClick: () => {
        //                         setDetailVisible(true);
        //                         setId(record.id);
        //                     },
        //                 },
        //             ]}
        //         />
        //     ),
    }];

    const detailProps = {
        visible: detailVisible,
        handleVisible: setDetailVisible,
        id,
    };

    return (
        <>
            <Table
                rowKey={(record: any) => record.id}
                size="small"
                loading={loading}
                showHeader={false}
                pagination={false}
                style={{ backgroundColor: '#fff', border: '0px', borderRadius: 0, marginBottom: 15 }}
                columns={columns}
                dataSource={data.list}
                title={false}
                scroll={{ y: 239 - 15 }}
                bodyStyle={{ padding: '0 16px', overflowY: 'auto' }}
                {...rest}
            />
            {/* {detailVisible && <Detail {...detailProps} />} */}
        </>
    );
};